<?php 

Class proController extends appController
{
	
	public function index()
	{
		//首页轮播
		$index_ad=$this->get_ad('pro_banner');
		$this->assign('pro_banner',$index_ad);
		
		//中间轮播
		$index_ad=$this->get_ad('pro_middle');
		$this->assign('pro_middle',$index_ad);
		$this->assign('ur_here',Model('pro')->where_am_i());
		$page=isset($_REQUEST['page'])?intval($_REQUEST['page']):1;
		$id=isset($_GET['id'])?intval($_GET['id']):'';
		$art_list=Model('pro')->pro_list($page,$id);
		$latter_pro=array();
		$upper_pro=array();
		$arr_len=count($art_list['data']);
		if($arr_len>6)
		{
			$upper_pro=array_slice($art_list['data'],0,6);
		  
			$latter_pro=array_slice($art_list['data'],6,$arr_len-6);
		 
		}
		else 
		{
			$upper_pro=$art_list['data'];
		}
		
		$this->assign('upper_pro',$upper_pro);
		$this->assign('latter_pro',$latter_pro);
		$this->assign('art_page',$art_list['pagelink']);
		$this->display('list.html');
	}
	public function view()
	{
		$id=isset($_GET['id'])?intval($_GET['id']):'';
		$art_info=Model('pro')->get_pro($id);
		$this->assign('ur_here',Model('pro')->where_am_i());
		$this->assign('pro',$art_info);
		$this->display('product_view.html');
	
	}
	
	

	
	
}